//
//  BinvishopDetaileViewController.m
//  Distributor
//
//  Created by 主事丫环 on 2019/5/16.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "BinvishopDetaileViewController.h"
#import "BshopZYCPViewController.h"

@interface BinvishopDetaileViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *headerImage;
@property (weak, nonatomic) IBOutlet UILabel *timeLB;
@property (weak, nonatomic) IBOutlet UILabel *shopName;
@property (weak, nonatomic) IBOutlet UILabel *lianxirenLB;
@property (weak, nonatomic) IBOutlet UILabel *zhuyingLB;
@property (weak, nonatomic) IBOutlet UILabel *addressLb;

@end

@implementation BinvishopDetaileViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"店铺信息";
    // Do any additional setup after loading the view.
    [self.leftbutton setImage:imgname(@"left_icon") forState:(UIControlStateNormal)];
    
    // Do any additional setup after loading the view from its nib.
    if ([_model.img hasPrefix:@"http"]) {
        [self.headerImage sd_setImageWithURL:[NSURL URLWithString:_model.img] placeholderImage:defaultImg];
    }else{
        sdimg(self.headerImage, _model.img);
        
    }
    
    self.shopName.text = [NSString stringWithFormat:@"%@",_model.name];
    self.timeLB.text = [NSString stringWithFormat:@"%@加入",[_model.create_time substringToIndex:10]];
    self.addressLb.text = [NSString stringWithFormat:@"%@",_model.address];

    [self request];
}
-(void)request{
    
    
    NSMutableDictionary *param = [NSMutableDictionary dictionaryWithCapacity:1];
    param[@"id"] = NOTNIL(_model.Id);
    
    [NetWorkTool POST:getNearShopInfo param:param success:^(id dic) {
        KMyLog(@"dsfdsfsdf%@",dic);
       NSDictionary * mudic = [dic objectForKey:@"data"];
        self.lianxirenLB.text = [NSString stringWithFormat:@"%@",[mudic objectForKey:@"person"]];
        self.zhuyingLB.text = [NSString stringWithFormat:@"%@",[mudic objectForKey:@"product"]];

        
        
        
        
        
    } other:^(id dic) {
        ShowToastWithText(dic[@"msg"]);
    } fail:^(NSError *error) {
        
    } needUser:YES];
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)callAction:(UIButton *)sender {
    [HFTools callMobilePhone:_model.phoen];
    
}

@end
